/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import dayjs from "./dayjs";

//clone
function clone_Test() {
  let a = dayjs('2019-03-09T07:20:20.666Z');
  let b;
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    b = a.clone();
    //print(a);
    //print(b);
  }
  let endTime = Date.now();
  if (!areEqual(a.toString(), b.toString())) {
    throw new Error('clone failed');
  }
  print(`dayjs_clone: ${(endTime - startTime)} ms`);
}

//Verify if it is valid
function isValid_Test() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.isValid();
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, true)) {
    throw new Error('isValid failed');
  }
  print(`dayjs_isValid: ${(endTime - startTime)} ms`);
}

//Obtain the current year
function year_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getFullYear();
  let startTime = Date.now();
  for (let i = 0; i < 1000000; i++) {
    a = day.year();
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) { 
    throw new Error('year failed');
  }
  print(`dayjs_year: ${(endTime - startTime)} ms`);
}

//Set year
function year_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.year(2000);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.year(), 2000)) {
    throw new Error('year failed');
  }
  print(`dayjs_year(value:number): ${(endTime - startTime)} ms`);
}

//Obtain the current month
function month_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMonth();
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a = day.month();
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) { 
    throw new Error('month failed');
  }
  print(`dayjs_month: ${(endTime - startTime)} ms`); 
}

//Set month
function month_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.month(11);
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.month(), 11)) {
    throw new Error('month failed');
  }
  print(`dayjs_month(value:number): ${(endTime - startTime)} ms`); 
}

//Get the current date
function date_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getDate();
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a = day.date();
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) { 
    throw new Error('Date failed');
  }
  print(`dayjs_date: ${(endTime - startTime)} ms`); 
}

//Set date
function date_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.date(5);
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.date(), 5)) {
    throw new Error('Date failed');
  }
  print(`dayjs_date(value:number): ${(endTime - startTime)} ms`);
}

//Get the current day of the week
function day_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getDay();
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a =  day.day();
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) { 
    throw new Error('Day failed');
  }
  print(`dayjs_day: ${(endTime - startTime)} ms`);
}

//Set the current day of the week
function day_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.day(5);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.day(), 5)) {
    throw new Error('Day failed');
  }
  print(`dayjs_day(value:number): ${(endTime - startTime)} ms`);
}

//Get the current hour
function hour_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getHours();
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a =  day.hour();
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) { 
    throw new Error('Hour failed');
  }
  print(`dayjs_hour: ${(endTime - startTime)} ms`);
}

//Set hour
function hour_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.hour(12);
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.hour(), 12)) {
    throw new Error('Hour failed');
  }
  print(`dayjs_hour(value:number): ${(endTime - startTime)} ms`);
}

//Get the current minute
function minute_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMinutes();
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a =  day.minute();
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) { 
    throw new Error('Minute failed');
  }
  print(`dayjs_minute: ${(endTime - startTime)} ms`);
}

//Set minute
function minute_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.minute(45);
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.minute(), 45)) {
    throw new Error('Minute failed');
  }
  print(`dayjs_minute(value:number): ${(endTime - startTime)} ms`);
}

//Get the current second
function second_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getSeconds();
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a =  day.second();
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) { 
    throw new Error('Second failed');
  }
  print(`dayjs_second: ${(endTime - startTime)} ms`);
}

//Set second
function second_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.second(45);
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.second(), 45)) {
    throw new Error('Second failed');
  }
  print(`dayjs_second(value:number): ${(endTime - startTime)} ms`);
}

//Get the current millisecond
function millisecond_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  var exceptValue = date.getMilliseconds();
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a =  day.millisecond();
    //print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('millisecond failed');
  }
  print(`dayjs_millisecond: ${(endTime - startTime)} ms`);
}

//Set millisecond
function millisecond_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.millisecond(999);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.millisecond(), 999)) {
    throw new Error('Millisecond failed');
  }
  print(`dayjs_millisecond(value:number): ${(endTime - startTime)} ms`);
}

//Set the current year through the set method
function set_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.set('year', 2013);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.year(), 2013)) {
    throw new Error('Set failed');
  }
  print(`dayjs_set(year): ${(endTime - startTime)} ms`);
}

//Set the current month through the set method(0-11)
function set_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.set('month', 6);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.month(), 6)) {
    throw new Error('Set failed');
  }
  print(`dayjs_set(month): ${(endTime - startTime)} ms`);
}

//Set the current date through the set method
function set_Test_03() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.set('date', 20);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.date(), 20)) {
    throw new Error('Set failed');
  }
  print(`dayjs_set(date): ${(endTime - startTime)} ms`);
}

//Set the current day through the set method(0-6)
function set_Test_04() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.set('day', 5);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.day(), 5)) {
    throw new Error('Set failed');
  }
  print(`dayjs_set(day): ${(endTime - startTime)} ms`);
}

//Set the current hour through the set method
function set_Test_05() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.set('hour', 5);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.hour(), 5)) {
    throw new Error('Set failed');
  }
  print(`dayjs_set(hour): ${(endTime - startTime)} ms`);
}

//Set the current minute through the set method
function set_Test_06() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.set('minute', 30);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.minute(), 30)) {
    throw new Error('Set failed');
  }
  print(`dayjs_set(minute): ${(endTime - startTime)} ms`);
}

//Set the current second through the set method
function set_Test_07() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.set('second', 30);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.second(), 30)) {
    throw new Error('Set failed');
  }
  print(`dayjs_set(second): ${(endTime - startTime)} ms`);
}

//Set the current millisecond through the set method
function set_Test_08() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a =  day.set('millisecond', 666);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.millisecond(), 666)) {
    throw new Error('Set failed');
  }
  print(`dayjs_set(millisecond): ${(endTime - startTime)} ms`);
}

//Get the current year through get method
function get_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getFullYear();
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.get('year');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('Get failed');
  }
  print(`dayjs_get(year): ${(endTime - startTime)} ms`);
}

//Get the current month through get method
function get_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMonth();
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.get('month');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('Get failed');
  }
  print(`dayjs_get(month): ${(endTime - startTime)} ms`);
}

//Get the current date through get method
function get_Test_03() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getDate();
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.get('date');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('Get failed');
  }
  print(`dayjs_get(date): ${(endTime - startTime)} ms`);
}

//Get the current day through get method
function get_Test_04() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getDay();
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.get('day');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('Get failed');
  }
  print(`dayjs_get(day): ${(endTime - startTime)} ms`);
}

//Get the current hour through get method
function get_Test_05() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getHours();
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.get('hour');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('Get failed');
  }
  print(`dayjs_get(hour): ${(endTime - startTime)} ms`);
}

//Get the current minute through get method
function get_Test_06() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMinutes();
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.get('minute');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('Get failed');
  }
  print(`dayjs_get(minute): ${(endTime - startTime)} ms`);
}

//Get the current second through get method
function get_Test_07() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getSeconds();
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.get('second');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('Get failed');
  }
  print(`dayjs_get(second): ${(endTime - startTime)} ms`);
}

//Get the current millisecond through get method
function get_Test_08() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMilliseconds();
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.get('millisecond');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('Get failed');
  }
  print(`dayjs_get(millisecond): ${(endTime - startTime)} ms`);
}

//One year after the current date
function add_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getFullYear() + 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.add(1, 'year');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.year(), exceptValue)) {
    throw new Error('add failed');
  }
  print(`dayjs_add(year): ${(endTime - startTime)} ms`);
}

//One month after the current date
function add_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMonth() + 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.add(1, 'month');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.month(), exceptValue)) {
    throw new Error('add failed');
  }
  print(`dayjs_add(month): ${(endTime - startTime)} ms`);
}

//One day after the current date
function add_Test_03() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getDate() + 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.add(1, 'day');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.date(), exceptValue)) {
    throw new Error('add failed');
  }
  print(`dayjs_add(day): ${(endTime - startTime)} ms`);
}

//One week after the current date
function add_Test_04() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getDate() + 7;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.add(1, 'week');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.date(), exceptValue)) {
    throw new Error('add failed');
  }
  print(`dayjs_add(week): ${(endTime - startTime)} ms`);
}

//One hour after the current date
function add_Test_05() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getHours() + 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.add(1, 'hour');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.hour(), exceptValue)) {
    throw new Error('add failed');
  }
  print(`dayjs_add(hour): ${(endTime - startTime)} ms`);
}

//One minute after the current date
function add_Test_06() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMinutes() + 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.add(1, 'minute');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.minute(), exceptValue)) {
    throw new Error('add failed');
  }
  print(`dayjs_add(minute): ${(endTime - startTime)} ms`);
}

//One second after the current date
function add_Test_07() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getSeconds() + 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.add(1, 'second');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.second(), exceptValue)) {
    throw new Error('add failed');
  }
  print(`dayjs_add(second): ${(endTime - startTime)} ms`);
}

//One second after the current date
function add_Test_08() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMilliseconds() + 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.add(1, 'millisecond');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.millisecond(), exceptValue)) {
    throw new Error('add failed');
  }
  print(`dayjs_add(millisecond): ${(endTime - startTime)} ms`);
}

//One year before the current date
function subtract_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getFullYear() - 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.subtract(1, 'year');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.year(), exceptValue)) {
    throw new Error('subtract failed');
  }
  print(`dayjs_subtract(year): ${(endTime - startTime)} ms`);
}

//One month before the current date
function subtract_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMonth() - 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.subtract(1, 'month');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.month(), exceptValue)) {
    throw new Error('subtract failed');
  }
  print(`dayjs_subtract(month): ${(endTime - startTime)} ms`);
}

//One date before the current date
function subtract_Test_03() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getDate() - 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.subtract(1, 'day');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.date(), exceptValue)) {
    throw new Error('subtract failed');
  }
  print(`dayjs_subtract(day): ${(endTime - startTime)} ms`);
}

//One week before the current date
function subtract_Test_04() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getDate() - 7;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.subtract(1, 'week');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.date(), exceptValue)) {
    throw new Error('subtract failed');
  }
  print(`dayjs_subtract(week): ${(endTime - startTime)} ms`);
}

//One hour before the current date
function subtract_Test_05() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getHours() - 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.subtract(1, 'hour');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.hour(), exceptValue)) {
    throw new Error('subtract failed');
  }
  print(`dayjs_subtract(hour): ${(endTime - startTime)} ms`);
}

//One minute before the current date
function subtract_Test_06() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMinutes() - 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.subtract(1, 'minute');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.minute(), exceptValue)) {
    throw new Error('subtract failed');
  }
  print(`dayjs_subtract(minute): ${(endTime - startTime)} ms`);
}

//One second before the current date
function subtract_Test_07() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getSeconds() - 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.subtract(1, 'second');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.second(), exceptValue)) {
    throw new Error('subtract failed');
  }
  print(`dayjs_subtract(second): ${(endTime - startTime)} ms`);
}

//One millisecond before the current date
function subtract_Test_08() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  let exceptValue = date.getMilliseconds() - 1;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.subtract(1, 'millisecond');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.millisecond(), exceptValue)) {
    throw new Error('subtract failed');
  }
  print(`dayjs_subtract(millisecond): ${(endTime - startTime)} ms`);
}

//Set the start of a year through startOf
function startOf_Test_01() {
  let day = dayjs("2024-04-10 02:30:30");
  let a;
  let exceptValue = dayjs("2024-01-01 00:00:00");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.startOf("year");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('startOf failed');
  }
  print(`dayjs_startOf(year): ${(endTime - startTime)} ms`);
}

//Set the start of a month through startOf
function startOf_Test_02() {
  let day = dayjs("2024-04-10 02:30:30");
  let a;
  let exceptValue = dayjs("2024-04-01 00:00:00");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.startOf("month");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('startOf failed');
  }
  print(`dayjs_startOf(month): ${(endTime - startTime)} ms`);
}

//Set the start of a date through startOf
function startOf_Test_03() {
  let day = dayjs("2024-04-10 02:30:30");
  let a;
  let exceptValue = dayjs("2024-04-10 00:00:00");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.startOf("date");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('startOf failed');
  }
  print(`dayjs_startOf(date): ${(endTime - startTime)} ms`);
}

//Set the start of a day through startOf
function startOf_Test_04() {
  let day = dayjs("2024-04-10 02:30:30");
  let a;
  let exceptValue = dayjs("2024-04-10 00:00:00");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.startOf("day");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('startOf failed');
  }
  print(`dayjs_startOf(day): ${(endTime - startTime)} ms`);
}

//Set the start of a week through startOf
function startOf_Test_05() {
  let day = dayjs("2024-04-10 02:30:30");
  let a;
  let exceptValue = dayjs("2024-04-07 00:00:00");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.startOf("week");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('startOf failed');
  }
  print(`dayjs_startOf(week): ${(endTime - startTime)} ms`);
}

//Set the start of a hour through startOf
function startOf_Test_06() {
  let day = dayjs("2024-04-10 02:30:30");
  let a;
  let exceptValue = dayjs("2024-04-10 02:00:00");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.startOf("hour");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('startOf failed');
  }
  print(`dayjs_startOf(hour): ${(endTime - startTime)} ms`);
}

//Set the start of a minute through startOf
function startOf_Test_07() {
  let day = dayjs("2024-04-10 02:30:30");
  let a;
  let exceptValue = dayjs("2024-04-10 02:30:00");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.startOf("minute");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('startOf failed');
  }
  print(`dayjs_startOf(minute): ${(endTime - startTime)} ms`);
}


//Set the start of a second through startOf
function startOf_Test_08() {
  let day = dayjs("2024-04-10 02:30:30.666");
  let a;
  let exceptValue = dayjs("2024-04-10 02:30:30:000");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.startOf("second");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('startOf failed');
  }
  print(`dayjs_startOf(second): ${(endTime - startTime)} ms`);
}


//Set the end of a year through endOf
function endof_Test_01() {
  let day = dayjs("2024-01-10 02:00:00");
  let a;
  let exceptValue = dayjs("2024-12-31 23:59:59:999");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.endOf("year");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('endOf failed');
  }
  print(`dayjs_endOf(year): ${(endTime - startTime)} ms`);
}

//Set the end of a month through endOf
function endof_Test_02() {
  let day = dayjs("2024-01-10 02:00:00");
  let a;
  let exceptValue = dayjs("2024-01-31 23:59:59:999");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.endOf("month");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('endOf failed');
  }
  print(`dayjs_endOf(month): ${(endTime - startTime)} ms`);
}

//Set the end of a day through endOf
function endof_Test_03() {
  let day = dayjs("2024-01-10 02:00:00");
  let a;
  let exceptValue = dayjs("2024-01-10 23:59:59:999");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.endOf("day");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('endOf failed');
  }
  print(`dayjs_endOf(day): ${(endTime - startTime)} ms`);
}

//Set the end of a date through endOf
function endof_Test_04() {
  let day = dayjs("2024-01-10 02:00:00");
  let a;
  let exceptValue = dayjs("2024-01-10 23:59:59:999");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.endOf("date");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('endOf failed');
  }
  print(`dayjs_endOf(date): ${(endTime - startTime)} ms`);
}

//Set the end of a week through endOf
function endof_Test_05() {
  let day = dayjs("2024-01-10 02:00:00");
  let a;
  let exceptValue = dayjs("2024-01-13 23:59:59:999");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.endOf("week");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('endOf failed');
  }
  print(`dayjs_endOf(week): ${(endTime - startTime)} ms`);
}

//Set the end of a hour through endOf
function endof_Test_06() {
  let day = dayjs("2024-01-10 02:00:00");
  let a;
  let exceptValue = dayjs("2024-01-10 02:59:59:999");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.endOf("hour");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('hour failed');
  }
  print(`dayjs_endOf(hour): ${(endTime - startTime)} ms`);
}

//Set the end of a minute through endOf
function endof_Test_07() {
  let day = dayjs("2024-01-10 02:00:00");
  let a;
  let exceptValue = dayjs("2024-01-10 02:00:59:999");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.endOf("minute");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('minute failed');
  }
  print(`dayjs_endOf(minute): ${(endTime - startTime)} ms`);
}

//Set the end of a second through endOf
function endof_Test_08() {
  let day = dayjs("2024-01-10 02:00:00");
  let a;
  let exceptValue = dayjs("2024-01-10 02:00:00:999");
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.endOf("second");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.valueOf(), exceptValue.valueOf())) {
    throw new Error('second failed');
  }
  print(`dayjs_endOf(second): ${(endTime - startTime)} ms`);
}

//Parse time without delimiters to obtain a timestamp
function format_Test() {
  let day = dayjs("20130108");
  let a;
  let exceptValue = "2013-01-08T00:00:00+08:00";
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.format();
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.toString(), exceptValue)) {
    throw new Error('format failed');
  }
  print(`dayjs_format: ${(endTime - startTime)} ms`);
}

//Get time difference (year)
function diff_Test_01() {
  let day = dayjs("2024-04-13 04:10:20:666");
  let a;
  let exceptValue = 2;
  let startTime = Date.now();
  for (let i = 0; i < 100; i++) {
    a = day.diff("2022-03-12 02:08:10:444", "year");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('diff failed');
  }
  print(`dayjs_diff(year): ${(endTime - startTime)} ms`);
}

//Get time difference (month)
function diff_Test_02() {
  let day = dayjs("2024-04-13 04:10:20:666");
  let a;
  let exceptValue = 25;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.diff("2022-03-12 02:08:10:444", "month");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('diff failed');
  }
  print(`dayjs_diff(month): ${(endTime - startTime)} ms`);
}

//Get time difference (day)
function diff_Test_03() {
  let day = dayjs("2024-04-13 04:10:20:666");
  let a;
  let exceptValue = 763;
  let startTime = Date.now();
  for (let i = 0; i < 100; i++) {
    a = day.diff("2022-03-12 02:08:10:444", "day");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('diff failed');
  }
  print(`dayjs_diff(day): ${(endTime - startTime)} ms`);
}

//Get time difference (week)
function diff_Test_04() {
  let day = dayjs("2024-04-13 04:10:20:666");
  let a;
  let exceptValue = 109;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.diff("2022-03-12 02:08:10:444", "week");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('diff failed');
  }
  print(`dayjs_diff(week): ${(endTime - startTime)} ms`);
}

//Get time difference (hour)
function diff_Test_05() {
  let day = dayjs("2024-04-13 04:10:20:666");
  let a;
  let exceptValue = 18314;
  let startTime = Date.now();
  for (let i = 0; i < 100; i++) {
    a = day.diff("2022-03-12 02:08:10:444", "hour");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('diff failed');
  }
  print(`dayjs_diff(hour): ${(endTime - startTime)} ms`);
}

//Get time difference (minute)
function diff_Test_06() {
  let day = dayjs("2024-04-13 04:10:20:666");
  let a;
  let exceptValue = 1098842;
  let startTime = Date.now();
  for (let i = 0; i < 100; i++) {
    a = day.diff("2022-03-12 02:08:10:444", "minute");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('diff failed');
  }
  print(`dayjs_diff(minute): ${(endTime - startTime)} ms`);
}

//Get time difference (second)
function diff_Test_07() {
  let day = dayjs("2024-04-13 04:10:20:666");
  let a;
  let exceptValue = 65930530;
  let startTime = Date.now();
  for (let i = 0; i < 100; i++) {
    a = day.diff("2022-03-12 02:08:10:444", "second");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('diff failed');
  }
  print(`dayjs_diff(second): ${(endTime - startTime)} ms`);
}

//Get time difference (millisecond)
function diff_Test_08() {
  let day = dayjs("2024-04-13 04:10:20:666");
  let a;
  let exceptValue = 65930530222;
  let startTime = Date.now();
  for (let i = 0; i < 100; i++) {
    a = day.diff("2022-03-12 02:08:10:444", "millisecond");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('diff failed');
  }
  print(`dayjs_diff(millisecond): ${(endTime - startTime)} ms`);
}

//Parsing time with hour, minutes, milliseconds, and seconds
function valueOf_Test() {
  let day = dayjs('2018-05-02 11:12:13.998');
  let a;
  let exceptValue = 1525230733998;
  let startTime = Date.now();
  for (let i = 0; i < 1000000; i++) {
    a = day.valueOf();
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('valueOf failed');
  }
  print(`dayjs_valueOf: ${(endTime - startTime)} ms`);
}

//Parsing time without delimiters to obtain timestamp(seconds)
function unix_Test() {
  let day = dayjs('20130108');
  let a;
  let exceptValue = 1357574400;
  let startTime = Date.now();
  for (let i = 0; i < 10000000; i++) {
    a = day.unix();
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('unix failed');
  }
  print(`dayjs_unix: ${(endTime - startTime)} ms`);
}

//Get the current number of days in the month
function daysInMonth_Test() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let date = new Date('2019-03-09T07:20:20.666Z');
  const year = date.getFullYear();
  const month = date.getMonth() + 1;
  let exceptValue = new Date(year, month, 0).getDate();
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.daysInMonth();
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, exceptValue)) {
    throw new Error('month failed');
  }
  print(`dayjs_daysInMonth: ${(endTime - startTime)} ms`);
}

//Get the native Date object from the current time Day.js object
function toDate_Test() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a = day.toDate();
    // print(a);
  }
  let endTime = Date.now();
  if (!(a instanceof Date)) {
    throw new Error('toDate failed');
  }
  print(`dayjs_toDate: ${(endTime - startTime)} ms`);
}

//Get the current time through the same toJSON
function toJSON_Test() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 10000; i++) {
    a = day.toJSON();
    // print(a);
  }
  let endTime = Date.now();
  let exceptValue = new Date('2019-03-09T07:20:20.666Z').toJSON();
  if (!areEqual(a.substring(0, 13), exceptValue.substring(0, 13))) {
    throw new Error('toJSON failed');
  }
  print(`dayjs_toJSON: ${(endTime - startTime)} ms`);
}

//Get the current time through the same toISOString
function toISOString_Test() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a = day.toISOString();
    // print(a);
  }
  let endTime = Date.now();
  let exceptValue = new Date('2019-03-09T07:20:20.666Z').toISOString();
  if (!areEqual(a.substring(0, 13), exceptValue.substring(0, 13))) {
    throw new Error('toISOString failed');
  }
  print(`dayjs_toISOString: ${(endTime - startTime)} ms`);
}

//Get the current time through the same toString
function toString_Test() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a = day.toString();
    // print(a);
  }
  let endTime = Date.now();
  let exceptValue = new Date('2019-03-09T07:20:20.666Z').toUTCString();
  if (!areEqual(a.substring(0, 13), exceptValue.substring(0, 13))) {
    throw new Error('toString failed');
  }
  print(`dayjs_toString: ${(endTime - startTime)} ms`);
}

//Set hour offset
function utcOffset_Test() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 100000; i++) {
    a = day.utcOffset(8);
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, 480)) {
    throw new Error('utcOffset failed');
  }
  print(`dayjs_utcOffSet: ${(endTime - startTime)} ms`);
}

//Is the object before another provided date(year)
function isBefore_Test_01() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.isBefore('2011-01-01', 'year');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isBefore failed');
  }
  print(`dayjs_isBefore(year): ${(endTime - startTime)} ms`);
}

//Is the object before another provided date(month)
function isBefore_Test_02() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.isBefore('2011-10-01', 'month');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isBefore failed');
  }
  print(`dayjs_isBefore(month): ${(endTime - startTime)} ms`);
}

//Is the object before another provided date(day)
function isBefore_Test_03() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.isBefore('2011-10-01', 'day');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isBefore failed');
  }
  print(`dayjs_isBefore(day): ${(endTime - startTime)} ms`);
}

//Is the object before another provided date(week)
function isBefore_Test_04() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.isBefore('2011-10-01', 'week');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isBefore failed');
  }
  print(`dayjs_isBefore(week): ${(endTime - startTime)} ms`);
}

//Is the object before another provided date(hour)
function isBefore_Test_05() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.isBefore('2011-10-01', 'hour');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isBefore failed');
  }
  print(`dayjs_isBefore(hour): ${(endTime - startTime)} ms`);
}

//Is the object before another provided date(minute)
function isBefore_Test_06() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.isBefore('2011-10-01', 'minute');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isBefore failed');
  }
  print(`dayjs_isBefore(minute): ${(endTime - startTime)} ms`);
}

//Is the object before another provided date(second)
function isBefore_Test_07() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.isBefore('2011-10-01', 'second');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isBefore failed');
  }
  print(`dayjs_isBefore(second): ${(endTime - startTime)} ms`);
}

//Is the object before another provided date(millisecond)
function isBefore_Test_08() {
  let day = dayjs('2019-03-09T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.isBefore('2011-10-01', 'millisecond');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isBefore failed');
  }
  print(`dayjs_isBefore(millisecond): ${(endTime - startTime)} ms`);
}

//Does the object have the same date and time provided by another provider (year)
function isSame_Test_01() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isSame(day2, 'year');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, true)) {
    throw new Error('isSame failed');
  }
  print(`dayjs_isSame(year): ${(endTime - startTime)} ms`);
}

//Does the object have the same date and time provided by another provider (month)
function isSame_Test_02() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isSame(day2, 'month');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, true)) {
    throw new Error('isSame failed');
  }
  print(`dayjs_isSame(month): ${(endTime - startTime)} ms`);
}

//Does the object have the same date and time provided by another provider (day)
function isSame_Test_03() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isSame(day2, 'day');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isSame failed');
  }
  print(`dayjs_isSame(day): ${(endTime - startTime)} ms`);
}

//Does the object have the same date and time provided by another provider (week)
function isSame_Test_04() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isSame(day2, 'week');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, true)) {
    throw new Error('isSame failed');
  }
  print(`dayjs_isSame(week): ${(endTime - startTime)} ms`);
}

//Does the object have the same date and time provided by another provider (hour)
function isSame_Test_05() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isSame(day2, 'hour');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isSame failed');
  }
  print(`dayjs_isSame(hour): ${(endTime - startTime)} ms`);
}

//Does the object have the same date and time provided by another provider (minute)
function isSame_Test_06() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isSame(day2, 'minute');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isSame failed');
  }
  print(`dayjs_isSame(minute): ${(endTime - startTime)} ms`);
}

//Does the object have the same date and time provided by another provider (second)
function isSame_Test_07() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isSame(day2, 'second');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isSame failed');
  }
  print(`dayjs_isSame(second): ${(endTime - startTime)} ms`);
}

//Does the object have the same date and time provided by another provider (millisecond)
function isSame_Test_08() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isSame(day2, 'millisecond');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isSame failed');
  }
  print(`dayjs_isSame(millisecond): ${(endTime - startTime)} ms`);
}

//Is the object after another provided date (year)
function isAfter_Test_01() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isAfter(day2, 'year');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isAfter failed');
  }
  print(`dayjs_isAfter(year): ${(endTime - startTime)} ms`);
}

//Is the object after another provided date (month)
function isAfter_Test_02() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isAfter(day2, 'month');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isAfter failed');
  }
  print(`dayjs_isAfter(month): ${(endTime - startTime)} ms`);
}

//Is the object after another provided date (day)
function isAfter_Test_03() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isAfter(day2, 'day');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, true)) {
    throw new Error('isAfter failed');
  }
  print(`dayjs_isAfter(day): ${(endTime - startTime)} ms`);
}

//Is the object after another provided date (week)
function isAfter_Test_04() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isAfter(day2, 'week');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, false)) {
    throw new Error('isAfter failed');
  }
  print(`dayjs_isAfter(week): ${(endTime - startTime)} ms`);
}

//Is the object after another provided date (hour)
function isAfter_Test_05() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isAfter(day2, 'hour');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, true)) {
    throw new Error('isAfter failed');
  }
  print(`dayjs_isAfter(hour): ${(endTime - startTime)} ms`);
}

//Is the object after another provided date (minute)
function isAfter_Test_06() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isAfter(day2, 'minute');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, true)) {
    throw new Error('isAfter failed');
  }
  print(`dayjs_isAfter(minute): ${(endTime - startTime)} ms`);
}

//Is the object after another provided date (second)
function isAfter_Test_07() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isAfter(day2, 'second');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, true)) {
    throw new Error('isAfter failed');
  }
  print(`dayjs_isAfter(second): ${(endTime - startTime)} ms`);
}

//Is the object after another provided date (millisecond)
function isAfter_Test_08() {
  let day1 = dayjs('2019-03-09T07:20:20.666Z');
  let day2 = dayjs('2019-03-08T07:20:20.666Z');
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day1.isAfter(day2, 'millisecond');
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a, true)) {
    throw new Error('isAfter failed');
  }
  print(`dayjs_isAfter(milliseconds): ${(endTime - startTime)} ms`);
}

//Local modification of language configuration
function locale_Test() {
  let day = dayjs("2023-05-05");
  let a;
  let startTime = Date.now();
  for (let i = 0; i < 1000; i++) {
    a = day.locale("en");
    // print(a);
  }
  let endTime = Date.now();
  if (!areEqual(a.format('dddd'), "Friday")) {
    throw new Error('locale failed');
  }
  print(`dayjs_locale: ${(endTime - startTime)} ms`);
}

// Expected results and actual results verification 
function areEqual(expected, actual) {
  // If expected and actual are both NaN, consider them equal.
  if (expected === actual || expected !== expected && actual !== actual) {
      return true;
  } else {
      return false;
  }
}

function main() {
  clone_Test();
  isValid_Test();
  year_Test_01();
  year_Test_02();
  month_Test_01();
  month_Test_02();
  date_Test_01();
  date_Test_02();
  day_Test_01();
  day_Test_02();
  hour_Test_01();
  hour_Test_02();
  minute_Test_01();
  minute_Test_02();
  second_Test_01();
  second_Test_02();
  millisecond_Test_01();
  millisecond_Test_02();
  set_Test_01();
  set_Test_02();
  set_Test_03();
  set_Test_04();
  set_Test_05();
  set_Test_06();
  set_Test_07();
  set_Test_08();
  get_Test_01();
  get_Test_02();
  get_Test_03();
  get_Test_04();
  get_Test_05();
  get_Test_06();
  get_Test_07();
  get_Test_08();
  add_Test_01();
  add_Test_02();
  add_Test_03();
  add_Test_04();
  add_Test_05();
  add_Test_06();
  add_Test_07();
  add_Test_08();
  subtract_Test_01();
  subtract_Test_02();
  subtract_Test_03();
  subtract_Test_04();
  subtract_Test_05();
  subtract_Test_06();
  subtract_Test_07();
  subtract_Test_08();
  startOf_Test_01();
  startOf_Test_02();
  startOf_Test_03();
  startOf_Test_04();
  startOf_Test_05();
  startOf_Test_06();
  startOf_Test_07();
  startOf_Test_08();
  endof_Test_01();
  endof_Test_02();
  endof_Test_03();
  endof_Test_04();
  endof_Test_05();
  endof_Test_06();
  endof_Test_07();
  endof_Test_08();
  format_Test();
  diff_Test_01();
  diff_Test_02();
  diff_Test_03();
  diff_Test_04();
  diff_Test_05();
  diff_Test_06();
  diff_Test_07();
  diff_Test_08();
  valueOf_Test();
  unix_Test();
  daysInMonth_Test();
  toDate_Test();
  toJSON_Test();
  toISOString_Test();
  toString_Test();
  utcOffset_Test();
  isBefore_Test_01();
  isBefore_Test_02();
  isBefore_Test_03();
  isBefore_Test_04();
  isBefore_Test_05();
  isBefore_Test_06();
  isBefore_Test_07();
  isBefore_Test_08();
  isSame_Test_01();
  isSame_Test_02();
  isSame_Test_03();
  isSame_Test_04();
  isSame_Test_05();
  isSame_Test_06();
  isSame_Test_07();
  isSame_Test_08();
  isAfter_Test_01();
  isAfter_Test_02();
  isAfter_Test_03();
  isAfter_Test_04();
  isAfter_Test_05();
  isAfter_Test_06();
  isAfter_Test_07();
  isAfter_Test_08();
  locale_Test();
}

let loopCountForPreheat = 1;
for (let i = 0; i < loopCountForPreheat; i++) {
  main();
}

ArkTools.waitAllJitCompileFinish();

main();